The present invention relates to data storage devices, control methods thereof and magnetic disk storage devices. In particular, the invention relates to cache mode control in data storage devices.
Devices using various types of media such as optical disks and magnetic tapes are known as information recording and reproducing devices. Among them, hard disk drives (HDDs) have become popular as storage devices for computers to such an extent that they are one type of the storage devices indispensable for today's computers. Further, not limited to computers, their application is widening more and more due to the superior characteristics with the advent of moving picture recording/reproducing devices, car navigation systems, removable memories for digital cameras and so on.
Each magnetic disk used in HDDs has a plurality of tracks formed concentrically and each track is partitioned into a plurality of sectors. In each sector, sector address information and user data are stored. Either data write to a sector or data read from the sector is enabled by a magnetic head (made of a thin film) which accesses the desired sector according to the sector address information. A signal read out from a magnetic disk through data read operation is subjected to waveform shaping, decoding processing and other prescribed signal processing by a signal processing circuit before being transmitted to the host. Likewise, data transferred from the host is subjected to prescribed signal processing by a signal processing circuit and then written to the magnetic disk.
As mentioned above, when data is written to a magnetic disk or read from the magnetic disk, some access time is required by the magnetic head to access a recording sector on the magnetic disk. Therefore, cache is employed in the HDD as a technique to raise the speed of data communication with the host in order to improve the performance. The HDD is provided with a sector buffer to temporally store user data. It is possible to raise the performance by performing data communication with the host by way of the sector buffer. Read cache and write cache are widely known as caches for HDDs.
In read cache, data are preliminarily read out from the magnetic disk and stored in a sector buffer before read commands to access the addresses are received from the host (Look ahead). If a read command received from the host specifies an address from which data has been read out into the sector buffer (cache hit), the data is sent back to the host from the sector buffer without accessing the magnetic disk.
In write cache, if a write command is received from the host, write data from the host is stored in a sector buffer and a command complete is returned to the host before write to the magnetic disk is completed. The command complete allows the host to issue a new command. In particular, if two write commands attempt to write data to adjacent sectors, this contributes much to raising the processing speed since the time to access the magnetic disk can be omitted.
As buffer handling techniques in HDDs, that is, as read cache or write cache features, various methods are known in addition to the ones mentioned above. For example, in “Write Back Read Cache”, if write data stored in the sector buffer is that which a received read command attempts to read, the write data stored in the sector buffer is sent back to the host regardless of whether its write to the magnetic disk is completed or not.
A cache mode setting technique is disclosed in Japanese Patent Laid-Open No. 2002-108704. In this technique, from a plurality of cache modes prepared, an appropriate cache mode is selected depending on the file access mode. According to the patent reference, which cache mode is appropriate is dependent on the program to file access mode. If an appropriate cache mode is not set and specified, performance deterioration may occur.
Thus, setting the most suitable cache mode for each file access mode raises the performance of the HDD. In the method disclosed in Japanese Patent Laid-Open No. 2002-108704, plural disk cache modes are set to the HDD as controlled by the host. Further, the host stores files in disk areas each of which is reserved for each file access type and associated with the most suitable cache mode for the file access type. When a file is used, the most suitable cache mode is set according to the file access type. Since the most suitable cache mode is set for each file, cache can be used effectively.